{% if master_num is defined and master_num != "0" %}
replicaCount: {{ master_num }}
{% else %}
replicaCount: 1
{% endif %}

image:
  ks_controller_manager_repo: {{ ks_controller_manager_repo }}
  ks_controller_manager_tag: {{ ks_controller_manager_tag }}
  ks_apiserver_repo: {{ ks_apiserver_repo }}
  ks_apiserver_tag: {{ ks_apiserver_tag }}
  ks_console_repo: {{ ks_console_repo }}
  ks_console_tag: {{ ks_console_tag }}
  ks_kubectl_repo: {{ ks_kubectl_repo }}
  ks_kubectl_tag: {{ ks_kubectl_tag }}
  nginx_ingress_controller_repo: {{ nginx_ingress_controller_repo }}
  nginx_ingress_controller_tag: {{ nginx_ingress_controller_tag }}
  defaultbackend_repo: {{ defaultbackend_repo }}
  defaultbackend_tag: {{ defaultbackend_tag }}
  bookinfo_productpage_v1_repo: {{ bookinfo_productpage_v1_repo }}
  bookinfo_productpage_v1_tag: {{ bookinfo_productpage_v1_tag }}
  bookinfo_reviews_v1_repo: {{ bookinfo_reviews_v1_repo }}
  bookinfo_reviews_v1_tag: {{ bookinfo_reviews_v1_tag }}
  bookinfo_details_v1_repo: {{ bookinfo_details_v1_repo }}
  bookinfo_details_v1_tag: {{ bookinfo_details_v1_tag }}
  bookinfo_ratings_v1_repo: {{ bookinfo_ratings_v1_repo }}
  bookinfo_ratings_v1_tag: {{ bookinfo_ratings_v1_tag }}
  pullPolicy: {{ ks_image_pull_policy }}

config:
  create: false

adminPassword: {% if adminPassword is defined %}"{{ adminPassword }}"{% else %}""{% endif %}

console:
  type: {{ common.core.console.type | default('NodePort') }}
  port: {{ common.core.console.port | default(30880)}}

{% if common.core.console.extraVolumeMounts is defined and common.core.console.extraVolumeMounts is not none %}
  extraVolumeMounts:
    {{ common.core.console.extraVolumeMounts | to_nice_yaml(indent=2) | indent(4) }}
{% endif %}

{% if common.core.console.extraVolumes is defined and common.core.console.extraVolumes is not none %}
  extraVolumes:
    {{ common.core.console.extraVolumes | to_nice_yaml(indent=2) | indent(4) }}
{% endif %}

kube_version: {{ kube_version }}

apiserver:
  resources:
    limits:
      cpu: {{ common.core.apiserver.resources.limits.cpu | default('1') }}
      memory: {{ common.core.apiserver.resources.limits.memory | default('1024Mi') }}
    requests:
      cpu: {{ common.core.apiserver.resources.requests.cpu | default('20m') }}
      memory: {{ common.core.apiserver.resources.requests.memory | default('100Mi') }}

controller:
  resources:
    limits:
      cpu: {{ common.core.controllerManager.resources.limits.cpu | default('1') }}
      memory: {{ common.core.controllerManager.resources.limits.memory | default('1000Mi') }}
    requests:
      cpu: {{ common.core.controllerManager.resources.requests.cpu | default('30m') }}
      memory: {{ common.core.controllerManager.resources.requests.memory | default('50Mi') }}
{% if (common.redis is defined and common.redis.enabled is defined and common.redis.enabled) or (enableHA is defined and enableHA) %}
env:
- name: KUBESPHERE_CACHE_OPTIONS_PASSWORD
  valueFrom:
    secretKeyRef:
      name: redis-secret
      key: auth
{% endif %}

{% if common.core.nodeAffinity is defined and common.core.nodeAffinity is not none %}
nodeAffinity:
  {{ common.core.nodeAffinity | to_nice_yaml(indent=2) | indent(2) }}
{% else %}
nodeAffinity:
  preferredDuringSchedulingIgnoredDuringExecution:
  - weight: 100
    preference:
      matchExpressions:
      - key: node-role.kubernetes.io/master
        operator: In
        values:
        - ""
{% endif %}

{% if common.core.nodeSelector is defined and common.core.nodeSelector is not none %}
nodeSelector:
  {{ common.core.nodeSelector | to_nice_yaml(indent=2) | indent(2) }}
{% elif nodeSelector is defined and nodeSelector is not none %}
nodeSelector:
  {{ nodeSelector | to_nice_yaml(indent=2) | indent(2) }}
{% else %}
nodeSelector: {}
{% endif %}
{% if common.core.tolerations is defined and common.core.tolerations is not none %}
tolerations:
  {{ common.core.tolerations | to_nice_yaml(indent=2) | indent(2) }}
{% elif tolerations is defined and tolerations is not none %}
tolerations:
  {{ tolerations | to_nice_yaml(indent=2) | indent(2) }}
{% else %}
tolerations:
  - key: node-role.kubernetes.io/master
    effect: NoSchedule
  - key: CriticalAddonsOnly
    operator: Exists
  - effect: NoExecute
    key: node.kubernetes.io/not-ready
    operator: Exists
    tolerationSeconds: 60
  - effect: NoExecute
    key: node.kubernetes.io/unreachable
    operator: Exists
    tolerationSeconds: 60
{% endif %}